<%-- 
    Document   : dataRuang
    Created on : Nov 22, 2011, 10:08:36 PM
    Author     : renaldo malau
--%>

<%@page import="javax.swing.JOptionPane"%>
<%@page import="databaseConnection.DatabaseConnection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
                    DatabaseConnection conn = new DatabaseConnection();

                     try {
                         String pesan;
                        java.sql.Statement statement = conn.connection.createStatement();
                        if (request.getParameter("ruang").equalsIgnoreCase("kamar")) {
                            String sisaKamar=JOptionPane.showInputDialog(null,"masukkan sisa kamar :");
                            String update = "update jadwalpemakaiankamar set "+request.getParameter("bln") +"='"+sisaKamar+"' where tanggal='"+request.getParameter("tgl")+"';";
                            statement.executeUpdate(update);
                            pesan="data kamar behasil diupdate";
                            
                        }else if(request.getParameter("ruang").equalsIgnoreCase("gedung")){
                            String update = "update jadwalpemakaiangedung set "+request.getParameter("bln") +"='"+request.getParameter("act")+"' where tanggal='"+request.getParameter("tgl")+"';";
                            statement.executeUpdate(update);
                            pesan="data gedung behasil diupdate";
                            
                        }else if(request.getParameter("ruang").equalsIgnoreCase("restoran")){
                            String update = "update jadwalpemakaianrestoran set "+request.getParameter("bln") +"='"+request.getParameter("act")+"' where tanggal='"+request.getParameter("tgl")+"';";
                            statement.executeUpdate(update);
                            pesan="data restoran behasil diupdate";
                            
                        }else{
                            pesan="update gagal";
                        }
                        response.sendRedirect("ubahStatus.jsp?msg="+pesan);
                    } catch (Exception ex) {
                        out.println("message: " + ex.getMessage());
                    }
        %>
    </body>
</html>
